import request from '@/utils/request'
// 工厂下拉列表
export function getFactoryList() {
  return request({
    url: '/basic/factory/selectList',
    method: 'get'
  })
}
// 查询物料信息管理列表
export function listProductSelectOne(query) {
  return request({
    url: '/equipment/goods/listProductSelectOne',
    method: 'get',
    params: query
  })
}


export function dateDifference(start, end) {
  // let d1 = new Date(faultDate);
  // let d2 = new Date(completeTime);
  var stime = new Date(start).getTime();
  var etime = new Date(end).getTime();
  var usedTime = etime - stime; //两个时间戳相差的毫秒数
  if (usedTime < 0) {
    return "0";
  }
  var days = Math.floor(usedTime / (24 * 3600 * 1000));
  //计算出小时数
  var leave1 = usedTime % (24 * 3600 * 1000); //计算天数后剩余的毫秒数
  var hours = Math.floor(leave1 / (3600 * 1000));
  //计算相差分钟数
  var leave2 = leave1 % (3600 * 1000); //计算小时数后剩余的毫秒数
  var minutes = Math.floor(leave2 / (60 * 1000));
  var time = days + "天" + hours + "时" + minutes + "分";
  //var time = days;
  return time;
}
